<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/selectCustomer.do"/>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>
<%@ page import="com.scalar.chiptrack.commons.SessionKeys"%>
<%@ page import="com.scalar.chiptrack.users.Functionality"%>
<%@ page import="com.scalar.chiptrack.users.User"%>

<% String chipTracContext = "/" + ConfigManager.getChipTracContext(); %>
<% User user1 = (User) session.getAttribute (SessionKeys.USER_KEY);  %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
<!--This additions have been made to give the functionality of success.jsp to this page as well-->
<%
    String action=request.getParameter("action");
    if( action == null )
    {
        action = "";
    }
    else
    {
        action = action.trim();
    }
%>
<!--End of additions by rohan on August 4th 2003-->

<SCRIPT language="JavaScript">
    function searchCustomer(theForm)
    {
        theForm.action.value = "SearchCustomer";
        theForm.submit();
    }

    function submitPage()
    {
        document.selectCustomerForm.action.value="SearchCustomer";
        document.selectCustomerForm.submit();
    }

    function showErrorReportPage()
    {
        newWindow = window.open ('<%=chipTracContext%>/reportProblem.do','reportProblem','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=750,height=400,resizable=no');
        newWindow.focus();
    }

    function openCustomer()
    {
        newWindow = window.open('customers.do?action=PrintCustomer&customerId=<%=(String)request.getAttribute("customerId")%>','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=600,height=600,left=100,top=50,resizable=yes');
        newWindow.focus();
    }

</SCRIPT>
</HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TR>
	    <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
            <!-- Side Navigation start -->
            <%@ include file="/jsp/sales/rma_menu.jsp" %>
            <!-- end of the side navigations -->
        </td>
        <TD bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%">
            <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR>
            <html:form name="selectCustomerForm" onsubmit="javascript:searchCustomer(document.selectCustomerForm)" method="post" action="/selectCustomerForRma" type="com.scalar.chiptrack.sales.forms.SelectCustomerForm">
            <center><span class="NArialW">Select the Customer for the RMA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></center>
            <img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
            <div align=center>
            <table border="0" width="90%">
                <tr>
                    <td>
                        <chiptrack:info styleClass="NArialL" />
                        <chiptrack:errors styleClass="NArialL" />
                        <chiptrack:messages type="info" styleClass="NArialL" />
                        &nbsp;
                    </td>
                </tr>
            </table>
            </div>
            <br>
            <table border="0" width="90%" align=center>
                <tr>
                    <td>
                        <table border="0" width="100%" align="center">
                            <tr>
                                <td width="15%" class="NArialL" align="center">Customer</td>
                                <td width="15%" class="NArialL" align="left">
      	                            <html:text name="selectCustomerForm" property="customerName" styleClass="txfield" size="23" />
                                </td>
                                <td width="5%" class="NArialL" align="right">(or)</td>
                                <td width="15%" class="NArialL" align="right">Select Customer</td>
                                <td width="50%" class="NArialL" align="center">
                                    <html:select name="selectCustomerForm" property="selectedCustomer" styleClass="txfield" >
                                        <html:options collection="customers" property="value" labelProperty="label"/>
                                    </html:select>
                                </tr>
                                <tr><td colspan='5'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                                <tr><td colspan='5'><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
                                <tr>
                                    <td colspan='5' align=center>
                                        <chiptrack:restrictedLink functionality='<%=Functionality.RMA_FORM%>' action='<%=User.USER_ACTION_VIEW%>' styleClass="leftsection" href="javascript:searchCustomer(document.selectCustomerForm);" onmouseover="window.status='Click to search for customers';return true" onmouseout="window.status='';return true"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/search.gif"title="click here To Search for Customers"></chiptrack:restrictedLink>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <a href="javascript:document.selectCustomerForm.reset();"onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17"></a>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    </td>
                                </tr>
                                <tr><td colspan='5'><img height=10 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr><tr><td>
                                <% if ( user1.isActionAllowed ( Functionality.RMA_FORM,User.USER_ACTION_VIEW ) ) { %>
                                <tr>
                                    <td width="30%" class="NArialL" colspan='2' align="center">
                                        To add a new RMA , please
                                        <chiptrack:restrictedLink functionality='<%=Functionality.RMA_FORM%>' action='<%=User.USER_ACTION_VIEW%>' styleClass="leftsection" href="javascript:searchCustomer(document.selectCustomerForm);" onmouseover="window.status='Click to Add New RMA Form ';return true" onmouseout="window.status='';return true">click here</chiptrack:restrictedLink>
                                    </td>
                                    <td colspan='3'>&nbsp;</td>
                                </tr>
                                <% } %>
                            </table>
                        </td>
                    </tr>
                    <tr><td><img height=10 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"></td></tr>
                    <tr>
                        <td>
                            <% int bgcount = 0;%>
                            <logic:equal name="showList" value="TRUE">
                            <table border="0" width="100%" bordercolor="#FFFFFF" align=right>
  	                            <tr>
                                    <td class="NArialL"><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td>
                                </tr>
                                <tr>
                                    <td width="15%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Customer Name</font></font></td>
                                    <td width="17%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Action</font></font></td>
                                </tr>
                              	<logic:iterate id="Customer" name="customersList">
                                <% bgcount = bgcount + 1; %>
                                <tr>
  	                                <td width="15%" align="left" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>
                                          <font class="NArialL">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 	<bean:write name="Customer" property="customerName" /></font>
                                    </td>
  	                                <td width="17%" align="center" <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>>
                                          <font class="NArialL">
                                              <chiptrack:linkCustomer page="/generateRMA.do?action=CreateForm" onmouseover="window.status='Click to Create New RMA Form';return true" onmouseout="window.status='';return true">Create RMA Form</chiptrack:linkCustomer>
                                            </font>
                                    </td>
                                </tr>
                                </logic:iterate>
                            </table>
                            </logic:equal>
                        </td>
                    </tr>
                </table>
                <input type="hidden" name="action" value="">
            </html:form>
            <!-- till here -->
            <BR><BR><BR>
        </TD>
        <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
    </TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>
